import requests

from untils.assert_untils import response_to_json
from untils.log_ import logger


# class BaseApi:
#
#
#     def __init__.py(self, base_url):
#         self.base_url = base_url
#         url = base_url + "/api/captchaImage"
#         uuid = requests.get(url=url).json().get("uuid")
#         url = base_url + "/api/login"
#         header = {"Content-Type": "application/json"}
#         Body = {"username": "admin", "password": "HM_2023_test",
#                 "code": "2", "uuid": uuid}
#         logger.debug(f"uuid：{uuid}")
#         self.token = requests.post(url=url, headers=header, json=Body).json().get("token")
#
#     def __set_header(self):
#         header = {"Content-Type": "application/json", "Authorization": self.token}
#         return header
#
#     def send(self, send_method=None, send_url=None, **kwargs):
#
#         response = requests.request(method=send_method, url=send_url, headers=self.__set_header(), **kwargs)
#         logger.debug(f"接口:\t{send_url}\t请求方法:{send_method}\t响应数据：{response_to_json(response)}")
#         return response_to_json(response)







